package com.daocheng.weblog.common.domain.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.daocheng.weblog.common.domain.dos.ArticleContentDO;
import com.daocheng.weblog.common.domain.dos.ArticleTagRelDO;

/**
 * @ClassName ArticleContentMapper
 * @author: 稻城
 * @date: 2025/3/11
 * @Version 1.0
 * @description: TODO
 */
public interface ArticleContentMapper extends BaseMapper<ArticleContentDO> {
    default int deleteByArticleId(Long articleId) {
        return delete(Wrappers.<ArticleContentDO>lambdaQuery().eq(ArticleContentDO::getArticleId, articleId));
    }

    default ArticleContentDO selectByArticleId(Long articleId) {
        return selectOne(Wrappers.<ArticleContentDO>lambdaQuery().eq(ArticleContentDO::getArticleId, articleId));
    }

    default int updateByArticleId(ArticleContentDO articleContentDO) {
        return update(articleContentDO, Wrappers.<ArticleContentDO>lambdaQuery().eq(ArticleContentDO::getArticleId, articleContentDO.getArticleId()));
    }
}
